\documentclass[10pt,oneside]{book}

\ifx \HCode\Undef
\newcommand*{\topdir}{.}%
\else
\def\pgfsysdriver{pgfsys-tex4ht.def}
\newcommand*{\topdir}{..}%
\fi

\usepackage{hyperref}
\usepackage{nameref}
\usepackage{minted}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{calc}
\usepackage{ulem}
\usepackage{tikz}
\usepackage{comment}
\usepackage[margin=1in]{geometry}
\usepackage[small,compact]{titlesec}
\usepackage[binary,squaren]{SIunits}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}
\usepackage{makeidx}

\makeindex
\AtBeginDocument{\renewcommand{\bibname}{References}}

\newcommand{\HyperDexVersion}{1.6.dev}
\newcommand{\code}[1]{\texttt{#1}}

% http://texblog.org/2012/03/21/cross-referencing-list-items/
\makeatletter
\def\namedlabel#1#2{\begingroup
    #2%
    \def\@currentlabel{#2}%
    \phantomsection\label{#1}\endgroup
}
\makeatother

\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{2}

\title{HyperDex Reference Manual v\HyperDexVersion}
\author{Robert Escriva, Bernard Wong, and Emin G{\"u}n Sirer}

\newminted{c}{samepage}
\newminted{console}{samepage}
\newminted{go}{samepage}
\newminted{java}{samepage}
\newminted{javascript}{samepage}
\newminted{json}{samepage}
\newminted{pycon}{samepage}
\newminted{python}{samepage}
\newminted{ruby}{samepage}

\begin{document}

\frontmatter
\maketitle
\tableofcontents

\mainmatter

\input{\topdir/introduction}
\input{\topdir/installation}

\part{For Developers}
\label{part:for-developers}
\input{\topdir/quick-start}
\input{\topdir/data-types}
\input{\topdir/async-ops}
\input{\topdir/atomic-ops}
\input{\topdir/documents}
\input{\topdir/authorization}
\input{\topdir/mongo}
\input{\topdir/transactions}

\part{For Administrators}
\label{part:for-admins}
\input{\topdir/backups}
\input{\topdir/fault-tolerance}
\input{\topdir/maintenance}
\input{\topdir/tuning}

\part{API Reference}
\label{part:api-ref}

\input{\topdir/c/client}
\input{\topdir/c/admin}

\input{\topdir/go/client}

\input{\topdir/java/client}

\input{\topdir/node.js/client}

\input{\topdir/python/client}

\input{\topdir/ruby/client}

\ifx \HCode\Undef % >>>>>>>>>>>>>>>>>>>
\backmatter

% Index
\clearpage
\addcontentsline{toc}{chapter}{Index}
\printindex

% References
\clearpage
\addcontentsline{toc}{chapter}{References}
\bibliographystyle{plain}
\bibliography{hyperdex}
\fi               % <<<<<<<<<<<<<<<<<<<

\end{document}
